//
//  MVAllKindModel.m
//  NewMusic
//
//  Created by dllo on 15/11/21.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "MVAllKindModel.h"
#import "MVTypeModel.h"
@implementation MVAllKindModel
-(instancetype)initWithDictionary:(NSDictionary *)dictionary {
    self = [super init];
    if (self) {
        self.subType = [NSMutableArray array];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        self.ID = [NSString stringWithFormat:@"%@", value];
    }
}
-(void)setValue:(id)value forKey:(NSString *)key {
    if ([key isEqualToString:@"parentId"]) {
        self.parentId = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqualToString:@"order"]) {
        self.order = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqualToString:@"subType"]) {
        NSArray *array = (NSArray *)value;
        for (NSDictionary *dic in array) {
            MVTypeModel *model = [[MVTypeModel alloc]initWithDictionary:dic];
            [self.subType addObject:model];
            [model release];
        }
    }else {
        [super setValue:value forKey:key];
    }
}

@end
